using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using CYZHAPI.Common.DB;
using CYZHAPI.Entity;
using CYZHAPI.IRepository;
using Oracle.ManagedDataAccess.Client;

namespace CYZHAPI.Repository {
    public class SpiResultRep : ReponsitoryBase<SpiResultModel>, ISpiResultRep {
        public SpiResultRep (IDapperContext dbContext) : base (dbContext) { }


        public List<SpiResultModel> GetList (string sWhere) {
            List<SpiResultModel> reList = new List<SpiResultModel> ();
            DataSet ds = base.GetList ("SPIResults", sWhere);
            if (ds.Tables[0].Rows.Count > 0) {
                foreach (DataRow dr in ds.Tables[0].Rows) {
                    SpiResultModel objBean = new SpiResultModel () {
                        id = Convert.ToInt32 (dr["id"]),
                        scope = dr["scope"].ToString (),
                        name = dr["Name"].ToString (),
                        starttime=Convert.ToDateTime (dr["starttime"]),
                        endtime=Convert.ToDateTime (dr["endtime"]),
                        algorithm = dr["algorithm"].ToString (),
                       
                        filename = dr["filename"].ToString (),
                        createtime = Convert.ToDateTime (dr["createtime"]),
                        createby = dr["createby"].ToString (),
                    };
                    reList.Add (objBean);
                    //foreach (DataColumn dc in ds.Tables[0].Columns) {}
                }
            } else {
                return null;
            }

            return reList;
        }

    }
}